package com.spring.cold.common;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jy
 * @date 2020-10-19
 */
public class LayReturn {
    private static final String SUCCESS_CODE = "0";
    private static final String ERROR_CODE = "1";
    private String code;
    private String msg;
    private Long count;
    private List data = new ArrayList<>();

    public LayReturn() {
    }

    public LayReturn(String code, String msg, Long count, List data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public static LayReturn success(Long count,List data){
        return new LayReturn(SUCCESS_CODE,"OK",count,data);
    }

    public static LayReturn error(){
        return new LayReturn(ERROR_CODE,"无数据",0L,null);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public List getData() {
        return data;
    }

    public void setData(List data) {
        this.data = data;
    }
}
